#include "stdafx.h"
#include "RenderSettingsTwBar.h"

#include "RenderingData.h"
#include "RenderingSettings.h"

using namespace medit;

static TwBar * bar = NULL;
static mgfx::RenderingData * renderingData;
static mgfx::RenderingSettings * renderingSettings;

void medit::showRenderSettingsBar( mgfx::RenderingData & renderData, mgfx::RenderingSettings & renderSettings)
{
	renderingData = &renderData;
	renderingSettings = &renderSettings;

	if(bar == NULL)
		bar = TwNewBar("Render settings");
	TwSetTopBar(bar);

	TwRemoveAllVars(bar);

	TwAddVarRW(bar, "Main light dir", TW_TYPE_DIR3F, &renderingData->MainLight.Direction, "");
	TwAddVarRW(bar, "Display icons", TW_TYPE_BOOLCPP, &renderingSettings->DisplayIcons, "");
	TwAddVarRW(bar, "Render particles CS", TW_TYPE_BOOLCPP, &renderingSettings->RenderParticlesCS, "");
}

void medit::hideRenderSettingsBar()
{
	if(bar != NULL)
		TwDeleteBar(bar);
	bar = NULL;
}
